<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		年<input type="text" id="input1"/>
		月<input type="text" id="input2"/>
		
		<button onclick="day()">=</button>
		<script>
			
			year = parseInt(input1.value)
			month = parseInt(input2.value)
			
			function leapYear(){
				if(year%4!=0){
					document.write("28天")
			}else if(year%100!=0){
				document.write("29天")
			}else if(year%400==0){
				document.write("29天")
			}else{
				document.write("28天")
			}
			
			function day(){
				switch(month){
					case 1:
						document.write("31天")
					case 2:
						document.write(leapYear())
					case 3:
						document.write("31天")
					case 4:
						document.write("30天")
					case 5:
						document.write("31天")
					case 6:
						document.write("30天")
					case 7:
						document.write("31天")
					case 8:
						document.write("31天")
					case 9:
						document.write("30天")
					case 10:
						document.write("31天")
					case 11:
						document.write("30天")
					case 12:
						document.write("31天")
					default:
						document.write("非有效输入")
				}
			}
			
		</script>
	</body>
</html>
